﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using Pcb.Common;

namespace Pcb.Web.admin.ajax
{
    /// <summary>
    /// UserHandler 的摘要说明
    /// </summary>
    public class UserHandler : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            string param = _Request.GetString("param", "");
            switch (param)
            {
                case "OrderList":
                    OrderList();
                    break;              
            }
        }

        /// <summary>
        /// 订单列表
        /// </summary>
        private void OrderList()
        {
            int totalRecord = 0;
            int pageIndex = _Request.GetInt("page", 1);
            int pageSize = _Request.GetInt("rows", 10);

            string[] condition = new string[4];
            string userName = _Request.GetString("userName", "");   // 幸福ID
            string nickName = _Request.GetString("nickName", "");
            string trueName = _Request.GetString("trueName", "");
            string mobile = _Request.GetString("mobile", "");
            condition[0] = userName;
            condition[1] = nickName;
            condition[2] = trueName;
            condition[3] = mobile;

            //AdminService.IAdminService _adminService = new AdminService.AdminServiceClient();
            string json = Pcb.BLL.OrdersBLL.GetOrderList(condition, pageIndex, pageSize, out totalRecord);

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(json);
            HttpContext.Current.Response.End();
        }


        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}